package mediator.prompt
{
    import com.zn.multilanguage.MultilanguageManager;
    
    import components.contorls.superClass.BaseAlert;
    
    import org.puremvc.as3.interfaces.IMediator;
    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.mediator.Mediator;

    /**
     *提示
     * @author zn
     *
     */
    public class PromptMediator extends Mediator implements IMediator
    {
        public static const NAME:String = "PromptMediator";

        public static const SHOW_ALERT_NOTE:String = "showAlertNote";

        public function PromptMediator(viewComponent:Object = null)
        {
            super(NAME, viewComponent);
        }

        /**
         *添加要监听的消息
         * @return
         *
         */
        override public function listNotificationInterests():Array
        {
            return [ SHOW_ALERT_NOTE ];
        }

        /**
         *消息处理
         * @param note
         *
         */
        override public function handleNotification(note:INotification):void
        {
            switch (note.getName())
            {
                case SHOW_ALERT_NOTE:
                {
                    showAlert(String(note.getBody()));
                    break;
                }
            }
        }

        private function showAlert(note:String):void
        {
            BaseAlert.show(note, MultilanguageManager.getString("tips"), null, true, BaseAlert.OK_BUTTON);
        }

    }
}
